//
//  WCNHomeImageView.m
//  WCN
//
//  Created by wsj2015 on 16/4/7.
//  Copyright © 2016年 ShanghaiCize Trade And Business Co., Ltd. All rights reserved.
//

#import "WCNHomeImageView.h"

#define kImageViewL kScreenWidth/2 *0.2812

@implementation WCNHomeImageView

{
    UILabel  *_label;
}

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
       
        
        
        
    }
    return self;
}
- (void)setFrame:(CGRect)frame{
    [super setFrame:frame];
    CGFloat spapce ;
    CGFloat topSapce;
    if (kScreenWidth ==320) {
        if (kScreenHeight ==480) {
            spapce = 0;
             topSapce =8;
        }else{
            spapce =8;
            topSapce =12;

        }
        
    }else if(kScreenWidth == 375){
        spapce = 10;
        topSapce = 0.322 * kImageViewL;
    }else if (kScreenWidth > 400){
        spapce = 15;
        topSapce = 0.322* kImageViewL;
    }
    UIImageView *imageView =[UIImageView new];
    imageView.frame = CGRectMake((kScreenWidth/2 -kImageViewL)/2,topSapce,  kImageViewL, kImageViewL);
    [self addSubview:imageView];
    self.imageView = imageView;
    UILabel *label =[UILabel new];
    label.textAlignment = NSTextAlignmentCenter;
    label.font =[UIFont systemFontOfSize:13];
   
    label.frame = CGRectMake(0, CGRectGetMaxY(imageView.frame)+spapce,kScreenWidth/2, 18);
    _label = label;
    [self addSubview:label];
}
- (void)setImage:(UIImage *)image{
    _image  =image;
   
    self.imageView.image = image;
}
- (void)setTitle:(NSString *)title{
    _title = title;
    _label.text = title;
}

@end
